﻿using System.Web.Mvc;
using doufu.Model;

namespace doufu.WebUI.Controllers
{
    public class AboutController : BaseController
    {
        public ActionResult Index()
        {
            return View(Services.About.Details(1));
        }

        public ActionResult ContactUs()
        {
            return View("Index", Services.About.Details(2));
        }

        public ActionResult Add(int? id)
        {
            var entity = id.HasValue ? Services.About.Details(id.Value) : new About();
            return View(entity);
        }
        [HttpPost]
        [ValidateInput(false)]
        public ActionResult Add(About entity)
        {
            if (ModelState.IsValid)
            {
                Services.About.SaveAbout(entity, this);
                return RedirectToAction("Index", "Home");
            }
            return View(entity);
        }
    }
}
